package cn.cvs.dao;

import cn.cvs.pojo.SysUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SysUserMapper {
    /**
     * 根据账号获取用户对象
     *
     * @param account
     * @return
     * @throws Exception
     */
    SysUser queryUserByAccount(@Param("account") String account) throws Exception;

    /**
     * 分页查询用户
     *
     * @param from
     * @param pageSize
     * @param queryRealName
     * @param queryRoleId
     * @return
     * @throws Exception
     */
    List<SysUser> queryUserListByPage(@Param("from") Integer from, @Param("pageSize") Integer pageSize,
                                      @Param("queryRealName") String queryRealName, @Param("queryRoleId") Integer queryRoleId)
            throws Exception;

    /**
     * 添加用户
     *
     * @param sysUser
     * @return
     * @throws Exception
     */
    Integer addUser(SysUser sysUser) throws Exception;

    /**
     * 通过Id查询对象
     *
     * @param id
     * @return
     * @throws Exception
     */
    SysUser queryUserById(@Param("id") String id) throws Exception;

    /**
     * 查询用户总记录数
     *
     * @return
     * @throws Exception
     */
    Integer queryUserTotalCount(@Param("queryRealName") String queryRealName, @Param("queryRoleId") Integer queryRoleId) throws Exception;

    /**
     * 修改用户
     *
     * @param sysUser
     * @return
     * @throws Exception
     */
    Integer modifyUser(SysUser sysUser) throws Exception;


    /**
     * 修改密码
     *
     * @param id
     * @param newPWD
     * @return
     * @throws Exception
     */
    Integer modifyPWD(@Param("id") String id, @Param("newPWD") String newPWD) throws Exception;


    /**
     * 删除用户
     *
     * @param id
     * @return
     * @throws Exception
     */
    Integer deleteUserById(@Param("id") String id) throws Exception;

}
